package com.etc.servlet.user;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.etc.common.VerifyCode;

@WebServlet("/user/randomimg.action")
public class RandomImageServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		OutputStream os = resp.getOutputStream();
		String tmp = VerifyCode.drawRamdomText(os);
		
		System.out.println("=======================" + tmp);
		// 获取session对象
		// 标记不同的客户端
		HttpSession session = req.getSession();
		
		session.setAttribute("random", tmp);
	}

	
}
